<template>
	<div class="content">
		<div class="main">
			<!-- 新增隶属科室dialog -->
			<el-dialog title="编辑员工性质" v-dialogDrag :visible.sync="addygDialogFormVisible" width="28%" :modal="false" :before-close="handleAddClose">
				<el-divider></el-divider>
				<!-- tabs -->
				<div class="tabs">
					<div class="tabsMain" style="padding: 12px;">
						<span style="font-size: 12px;">员工性质：</span>
						  <el-select v-model="staffAtte" placeholder="请选择" style="margin-left: 12px;" size="mini">
						    <el-option
						      v-for="item in deptOption"
						      :key="item.id"
						      :label="item.label"
						      :value="item">
						    </el-option>
						  </el-select>
					</div>
				</div>
			  <div slot="footer" class="dialog-footer">
				<el-button size="mini" type="primary" @click="addNewyg">添加</el-button>
				<el-button size="mini" @click="cancel">取消</el-button>
			  </div>
			</el-dialog>
		</div>
		<div class="feet">
			
		</div>
	</div>
</template>

<script>
	// selfs / sons
	// 接口
	import { findAttribute } from "@/api/user.js";
	export default {
		components: {
			
		},
		data() {
			return {
				idx:'',
				loading:false,
				addygDialogFormVisible:false,
				// title右侧按钮
				headerBtn:[{ add:"add", title:"", type:"text", icon:"el-icon-plus" },{ adit:"adit", title:"", type:"text", icon:"el-icon-edit" }, { del:"del", title:"", type:"text", icon:"el-icon-delete" }],
				tableData:[],
				deptOption:[
					{id:1,label:'医生',value:'医生'},{id:2,label:'护士',value:'护士'},{id:3,label:'技师',value:'技师'},
					{id:4,label:'药师',value:'药师'},{id:5,label:'其他',value:'其他'}
				],
				formType:[{ id:0, label:'员工属性：',spanRows:24,type:'select',modelValue:'deptName',prefix:'el-icon-require',im:true,placeholder:'',op:'deptOption' }],
				statusOptions:[{id:1,label:'是',value:'是'},{id:2,label:'否',value:'否'}],
				tableRowsI:[{ name:"员工属性", prop:"id", type:"" }],
				tableRows:[{ name:"科室名称", prop:"id", type:"" },{ name:"主要科室", prop:"coding", type:"" },{ name:"院区序号", prop:"drugName", type:"" }],
				// obj
				addKsForm:{
					staffAtte:'',
				},
				staffAtte:'',
				
			}
		},
		methods: {
			// 数据源
			loadData(){
				
			},
			// 新增提交
			addNewyg(){
				console.log(this.staffAtte);
				// 设置一个定时器 用于传递成功后清空原数据源
				this.loading = true;
				this.disabled = true;
				setTimeout(() => {
					this.$emit('addygData',this.staffAtte)
					this.loading = false;
				this.$message({
				  message: '员工性质已添加！',
				  type: 'success',
				  duration: 1500,
				});
				this.disabled = false;
				this.addygDialogFormVisible = false;
				}, 1500)
			},
			//  select聚焦
			async sname(v,i) {
				console.log(v,i);
				// v.id = i;
				this.idx = i;
				// i event
				switch (i) {
					case 0:
					//  模糊搜索接口select函数
					break;
				}
			},
			scname(v){
				// v.id = this.idx;
				// v.tel !== undefined ? this.addForm.personInChargeTel = v.tel : v.tel
				// i event
				switch (this.idx) {
					case 0:
					// 字段映射
						this.addKsForm.deptId = v.id
						this.addKsForm.deptName = v.value
						// this.addKsForm.specialtyName = v.specialtyName
						break;
					case 1:
						// 急诊
						this.addKsForm.mainDep = v.value
					}
			},
			// 步骤
			handClick(i) {
				// i event
				switch (i) {
					case 0:
						// 处理索引0的逻辑 打开隶属科室model
						console.log('0')
						break;
					case 1:
						// 处理索引1的逻辑
						this.$confirm('敬请期待')
							.then(_ => {})
							.catch(_ => {});
						break;
					case 2:
						// 处理索引2的逻辑 => 新增
						console.log('2')
						break;
				}
			},
			// 打开addKsDialogFormVisible Model
			OpenaddygDialogFormVisible(){
				this.addygDialogFormVisible = true;
			},
			cancel(){
				this.addygDialogFormVisible = false;
			},
			// 关闭
			handleAddClose(done) {
				this.$confirm('确认关闭？')
				  .then(_ => {
					  done();
					// this.formdisabled = true;
					// location.reload();
					// done();
				  })
				  .catch(_ => {
					this.formdisabled = this.formdisabled;
				  });
			},
		},

		//生命周期
		created() {
			
		},

	}
</script>

<style lang="less" scoped>
.content{
	height: 100%;
	width: 100%;
	.header{
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #007bb0;
		padding: 4px;
	}
	.main{
		height: 100%;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.mainOne{
			flex: 1;
			height: 50%;
			border: 1px solid #007bb0;
			
		}
		.mainTwo{
			flex: 1;
			height: 50%;
			margin-top: 12px;
			border: 1px solid #007bb0;
		}
	}
}
</style>